package com.lxq.www.dao;

import com.lxq.www.pojo.Article;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;


public interface ArticleDao{

    @Select("SELECT * FROM articles where scope='公开' and state='正常'")
    ArrayList<Article> getPublicAll();

    @Select("SELECT * FROM articles where articleId=#{articleId} and scope='公开' and state='正常'")
    Article getById(String articleId);

    @Select("select articleId,title,summary,author,publishDate,user,img,footprint,scope,visitCount from articles")
    ArrayList<Article> getPublicAllForList();

    @Update("update articles set visitCount=visitCount+1 where articleId=#{articleId}")
    boolean visitCountUp(String articleId);
}